<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>bind方法实验</title>
</head>
<body>
    <script>
        function foo(name,age,height,address){
            console.log("foo:",this);
            console.log("参数:",name,age,height,address);
        }
        var obj={name:"gkd"};
        var bar=foo.bind(obj);
        bar();

        var barWithArgs=foo.bind(obj,"kobe",18,1.88);
        barWithArgs("james");
    </script>
</body>
</html>